/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jwu2.addondb;

import java.util.Comparator;

/**
 *
 * @author Rolf
 */
public class AddonDBEntryComparator implements Comparator {

    public AddonDBEntryComparator() {
    }

    public int compare(Object o1, Object o2) {
        if( o1 == null && o2 == null) {
            return 0;
        }
        else if( o1 == null) {
            return 1;
        }
        else if( o1 instanceof AddonDBEntry && o2 instanceof AddonDBEntry) {
            AddonDBEntry a1 = (AddonDBEntry) o1;
            AddonDBEntry a2 = (AddonDBEntry) o2;
            
            return a1.getAddonName().toLowerCase().compareTo(a2.getAddonName().toLowerCase());
        }
        
        return 1;
    }

}
